//我发布的书
const {Commodity} = require('../../../models/commodity');

module.exports = async (req, res) => {
    var userId = req.query.user_id;
    try{
        const pub = await Commodity.find({user_id:userId},{Art_No:1});
        if(pub){
            res.send({errCode:"0",msg:"success",data:{pubNum: pub.length}})
        }else{
            res.send({errCode:"0",msg:"success",data:{pubNum: 0}})
        }
    }catch(e){
        console.log(e)
        res.status(400).send({errCode:"1"})
    }
}